package com.example.gymlearning.service;

import com.example.gymlearning.dto.KnowledgePointDTO;
import com.example.gymlearning.entity.KnowledgePoint;
import com.github.pagehelper.Page;

import java.util.List;

/**
 * (KnowledgePoint)表服务接口
 *
 * @author makejava
 * @since 2025-10-27 21:05:53
 */
public interface KnowledgePointService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    KnowledgePoint queryById(Long id);

    /**
  
    /**
     * 新增数据
     *
     * @param knowledgePoint 实例对象
     * @return 实例对象
     */
    KnowledgePoint insert(KnowledgePoint knowledgePoint);

    /**
     * 修改数据
     *
     * @param knowledgePoint 实例对象
     * @return 实例对象
     */
    KnowledgePoint update(KnowledgePoint knowledgePoint);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    boolean deleteById(Long id);




    // 根据知识包ID获取知识点列表
    List<KnowledgePointDTO> getPointsByPackageId(Long packageId);

    // 获取知识点详情（返回DTO）
    KnowledgePointDTO getPointDetail(Long pointId);

    Long getPackageIdByPointId(Long pointId);
        // 实现根据知识点ID获取知识包ID的逻辑

    // 实现统计知识包内知识点数量的逻辑
    int getPointCountByPackage(Long packageId);

    /**
     * 通过ID获取知识点（与queryById功能相同，为保持一致性添加）
     */
    KnowledgePoint getById(Long id);

    /**
     * 解锁下一个知识点
     */
    void unlockNextPoint(Long pointId);

    Page<KnowledgePointDTO> getPointsByPackageIdWithPagination(Long packageId, int page, int size);

}
